package cn.ultrarisk.scadmin.manager.biz.monitor.entity;

import cn.ultrarisk.mybatis.extension.annotation.Table;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * solr节点监控实体类
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/4/14
 * @since V1.0
 */
@Table(table = "solr_node_monitor", idColumn = SolrNodeMonitor.ID, autoIncrement = true)
public class SolrNodeMonitor implements Serializable {
    private static final long serialVersionUID = -4649744057365219734L;

    public static final int STATUS_ALIVE = 1;
    public static final int STATUS_DOWN = -1;

    public final static String ID = "id";
    public final static String NODE_ID = "node_id";
    public final static String STATUS = "status";
    public final static String JVM_TOTAL_MEMORY = "jvm_total_memory";
    public final static String JVM_FREE_MEMORY = "jvm_free_memory";
    public final static String JVM_MAX_MEMORY = "jvm_max_memory";
    public final static String JVM_USED_MEMORY = "jvm_used_memory";
    public final static String JVM_USED_MEMORY_PERCENT = "jvm_used_memory_percent";
    public final static String JVM_UPTIME = "jvm_uptime";
    public final static String SYSTEM_LOAD_AVERAGE_1MIN = "system_load_average_1min";
    public final static String SYSTEM_LOAD_AVERAGE_5MIN = "system_load_average_5min";
    public final static String SYSTEM_LOAD_AVERAGE_15MIN = "system_load_average_15min";
    public final static String SYSTEM_COMMITTED_VIRTUAL_MEMORY = "system_committed_virtual_memory";
    public final static String SYSTEM_FREE_PHYSICAL_MEMORY = "system_free_physical_memory";
    public final static String SYSTEM_TOTAL_PHYSICAL_MEMORY = "system_total_physical_memory";
    public final static String SYSTEM_FREE_SWAP_SPACE = "system_free_swap_space";
    public final static String SYSTEM_TOTAL_SWAP_SPACE = "system_total_swap_space";
    public final static String SYSTEM_OPEN_FILE_DESCRIPTOR_COUNT = "system_open_file_descriptor_count";
    public final static String SYSTEM_MAX_FILE_DESCRIPTOR_COUNT = "system_max_file_descriptor_count";
    public final static String SYSTEM_UPTIME = "system_uptime";
    public final static String CREATE_TIME = "create_time";

    public static final Map<String, String> COLUMN_PROPERTY_MAP = new LinkedHashMap<String, String>();

    static {
        COLUMN_PROPERTY_MAP.put(ID, "id");
        COLUMN_PROPERTY_MAP.put(NODE_ID, "nodeId");
        COLUMN_PROPERTY_MAP.put(STATUS, "status");
        COLUMN_PROPERTY_MAP.put(JVM_TOTAL_MEMORY, "jvmTotalMemory");
        COLUMN_PROPERTY_MAP.put(JVM_FREE_MEMORY, "jvmFreeMemory");
        COLUMN_PROPERTY_MAP.put(JVM_MAX_MEMORY, "jvmMaxMemory");
        COLUMN_PROPERTY_MAP.put(JVM_USED_MEMORY, "jvmUsedMemory");
        COLUMN_PROPERTY_MAP.put(JVM_USED_MEMORY_PERCENT, "jvmUsedMemoryPercent");
        COLUMN_PROPERTY_MAP.put(JVM_UPTIME, "jvmUptime");
        COLUMN_PROPERTY_MAP.put(SYSTEM_LOAD_AVERAGE_1MIN, "systemLoadAverage1min");
        COLUMN_PROPERTY_MAP.put(SYSTEM_LOAD_AVERAGE_5MIN, "systemLoadAverage5min");
        COLUMN_PROPERTY_MAP.put(SYSTEM_LOAD_AVERAGE_15MIN, "systemLoadAverage15min");
        COLUMN_PROPERTY_MAP.put(SYSTEM_COMMITTED_VIRTUAL_MEMORY, "systemCommittedVirtualMemory");
        COLUMN_PROPERTY_MAP.put(SYSTEM_FREE_PHYSICAL_MEMORY, "systemFreePhysicalMemory");
        COLUMN_PROPERTY_MAP.put(SYSTEM_TOTAL_PHYSICAL_MEMORY, "systemTotalPhysicalMemory");
        COLUMN_PROPERTY_MAP.put(SYSTEM_FREE_SWAP_SPACE, "systemFreeSwapSpace");
        COLUMN_PROPERTY_MAP.put(SYSTEM_TOTAL_SWAP_SPACE, "systemTotalSwapSpace");
        COLUMN_PROPERTY_MAP.put(SYSTEM_OPEN_FILE_DESCRIPTOR_COUNT, "systemOpenFileDescriptorCount");
        COLUMN_PROPERTY_MAP.put(SYSTEM_MAX_FILE_DESCRIPTOR_COUNT, "systemMaxFileDescriptorCount");
        COLUMN_PROPERTY_MAP.put(SYSTEM_UPTIME, "systemUptime");
        COLUMN_PROPERTY_MAP.put(CREATE_TIME, "createTime");
    }

    /**
     * id
     */
    private Long id;
    /**
     * 节点id
     */
    private Integer nodeId;
    /**
     * 状态
     */
    private Integer status;
    /**
     * jvm总内存
     */
    private Long jvmTotalMemory;
    /**
     * jvm空闲内存
     */
    private Long jvmFreeMemory;
    /**
     * jvm最大内存
     */
    private Long jvmMaxMemory;
    /**
     * jvm已使用内存
     */
    private Long jvmUsedMemory;
    /**
     * jvm已使用内存百分比
     */
    private Double jvmUsedMemoryPercent;
    /**
     * jvm运行时间(ms)
     */
    private Long jvmUptime;
    /**
     * 系统1分钟平均负载
     */
    private Double systemLoadAverage1min;
    /**
     * 系统5分钟平均负载
     */
    private Double systemLoadAverage5min;
    /**
     * 系统15分钟平均负载
     */
    private Double systemLoadAverage15min;
    /**
     * 系统虚拟内存
     */
    private Long systemCommittedVirtualMemory;
    /**
     * 系统空闲内存
     */
    private Long systemFreePhysicalMemory;
    /**
     * 系统总物理内存
     */
    private Long systemTotalPhysicalMemory;
    /**
     * 系统空闲交换空间
     */
    private Long systemFreeSwapSpace;
    /**
     * 系统总交换空间
     */
    private Long systemTotalSwapSpace;
    /**
     * 系统已打开文件数
     */
    private Integer systemOpenFileDescriptorCount;
    /**
     * 系统最大文件数
     */
    private Integer systemMaxFileDescriptorCount;
    /**
     * 系统运行时间
     */
    private String systemUptime;
    /**
     * 创建时间
     */
    private Long createTime;

    public SolrNodeMonitor() {
    }

    public SolrNodeMonitor(Integer nodeId, Integer status) {
        this.nodeId = nodeId;
        this.status = status;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getNodeId() {
        return nodeId;
    }

    public void setNodeId(Integer nodeId) {
        this.nodeId = nodeId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long getJvmTotalMemory() {
        return jvmTotalMemory;
    }

    public void setJvmTotalMemory(Long jvmTotalMemory) {
        this.jvmTotalMemory = jvmTotalMemory;
    }

    public Long getJvmFreeMemory() {
        return jvmFreeMemory;
    }

    public void setJvmFreeMemory(Long jvmFreeMemory) {
        this.jvmFreeMemory = jvmFreeMemory;
    }

    public Long getJvmMaxMemory() {
        return jvmMaxMemory;
    }

    public void setJvmMaxMemory(Long jvmMaxMemory) {
        this.jvmMaxMemory = jvmMaxMemory;
    }

    public Long getJvmUsedMemory() {
        return jvmUsedMemory;
    }

    public void setJvmUsedMemory(Long jvmUsedMemory) {
        this.jvmUsedMemory = jvmUsedMemory;
    }

    public Double getJvmUsedMemoryPercent() {
        return jvmUsedMemoryPercent;
    }

    public void setJvmUsedMemoryPercent(Double jvmUsedMemoryPercent) {
        this.jvmUsedMemoryPercent = jvmUsedMemoryPercent;
    }

    public Long getJvmUptime() {
        return jvmUptime;
    }

    public void setJvmUptime(Long jvmUptime) {
        this.jvmUptime = jvmUptime;
    }

    public Double getSystemLoadAverage1min() {
        return systemLoadAverage1min;
    }

    public void setSystemLoadAverage1min(Double systemLoadAverage1min) {
        this.systemLoadAverage1min = systemLoadAverage1min;
    }

    public Double getSystemLoadAverage5min() {
        return systemLoadAverage5min;
    }

    public void setSystemLoadAverage5min(Double systemLoadAverage5min) {
        this.systemLoadAverage5min = systemLoadAverage5min;
    }

    public Double getSystemLoadAverage15min() {
        return systemLoadAverage15min;
    }

    public void setSystemLoadAverage15min(Double systemLoadAverage15min) {
        this.systemLoadAverage15min = systemLoadAverage15min;
    }

    public Long getSystemCommittedVirtualMemory() {
        return systemCommittedVirtualMemory;
    }

    public void setSystemCommittedVirtualMemory(Long systemCommittedVirtualMemory) {
        this.systemCommittedVirtualMemory = systemCommittedVirtualMemory;
    }

    public Long getSystemFreePhysicalMemory() {
        return systemFreePhysicalMemory;
    }

    public void setSystemFreePhysicalMemory(Long systemFreePhysicalMemory) {
        this.systemFreePhysicalMemory = systemFreePhysicalMemory;
    }

    public Long getSystemTotalPhysicalMemory() {
        return systemTotalPhysicalMemory;
    }

    public void setSystemTotalPhysicalMemory(Long systemTotalPhysicalMemory) {
        this.systemTotalPhysicalMemory = systemTotalPhysicalMemory;
    }

    public Long getSystemFreeSwapSpace() {
        return systemFreeSwapSpace;
    }

    public void setSystemFreeSwapSpace(Long systemFreeSwapSpace) {
        this.systemFreeSwapSpace = systemFreeSwapSpace;
    }

    public Long getSystemTotalSwapSpace() {
        return systemTotalSwapSpace;
    }

    public void setSystemTotalSwapSpace(Long systemTotalSwapSpace) {
        this.systemTotalSwapSpace = systemTotalSwapSpace;
    }

    public Integer getSystemOpenFileDescriptorCount() {
        return systemOpenFileDescriptorCount;
    }

    public void setSystemOpenFileDescriptorCount(Integer systemOpenFileDescriptorCount) {
        this.systemOpenFileDescriptorCount = systemOpenFileDescriptorCount;
    }

    public Integer getSystemMaxFileDescriptorCount() {
        return systemMaxFileDescriptorCount;
    }

    public void setSystemMaxFileDescriptorCount(Integer systemMaxFileDescriptorCount) {
        this.systemMaxFileDescriptorCount = systemMaxFileDescriptorCount;
    }

    public String getSystemUptime() {
        return systemUptime;
    }

    public void setSystemUptime(String systemUptime) {
        this.systemUptime = systemUptime;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

}